<template>
  <div class="table_list">
    <ul v-if="fromPage=='subordinates'">
      <li class="van_item" v-for="(item,index) in tableList" :key="index" @click="subordinatesInfo(item.id)">
        <ul class="item_list">
          <li class="item_list_item first_item_list_item">
            <div class="item_user_info">
              <img v-if="item.fd_sta_photo" :src="item.fd_sta_photo" alt="头像" />
              <img v-else :src="pic" alt="头像" />
              <div>
                <span>{{item.fd_sta_name}}</span>
                <br />
                <span>{{item.fd_jobs_name}}</span>
              </div>
            </div>
          </li>
          <li class="item_list_item" v-if="item.cycle_status_desc">
            <span class="cycle_status_desc">{{item.cycle_status_desc.slice(0,3)}}</span>
            <span class="cycle_status_desc">{{item.cycle_status_desc.slice(3)}}</span>
          </li>
          <li class="item_list_item" v-else>-</li>
          <li class="item_list_item" v-if="item.end_time">{{item.end_time.slice(5)}}</li>
          <li class="item_list_item" v-else>-</li>
          <li class="item_list_item" :class="{warning:Number(item.assessment_order_num)<1}">{{Number(item.assessment_order_num)}}</li>
          <li class="item_list_item" :class="{warning:Number(item.assessment_total_score)<80}">{{Number(item.assessment_total_score)}}</li>
        </ul>
      </li>
    </ul>
    <ul v-if="fromPage=='subordinatesDelay'">
      <li class="van_item" v-for="(item,index) in tableList" :key="index" @click="subordinatesInfo(item.id)">
        <ul class="item_list">
          <li class="item_list_item first_item_list_item">
            <div class="item_user_info">
              <img v-if="item.fd_sta_photo" :src="item.fd_sta_photo" alt="头像" />
              <img v-else :src="pic" alt="头像" />
              <div>
                <span>{{item.fd_sta_name}}</span>
                <br />
                <span>{{item.fd_jobs_name}}</span>
              </div>
            </div>
          </li>
          <li class="item_list_item">
            <span class="cycle_status_desc">09-10</span>
            <span>至</span>
            <span class="cycle_status_desc">05-10</span>
          </li>
          <li class="item_list_item" :class="{warning:Number(item.assessment_total_score)<80}">{{Number(item.assessment_total_score)}}</li>
        </ul>
      </li>
    </ul>
    <ul v-if="fromPage=='performanceTabs'">
      <li class="van_item" v-for="(item,index) in tableList" :key="index" @click="subordinatesInfo(item.fd_sta_id)" >
        <ul class="item_list">
          <li class="item_list_item first_item_list_item">
            <div class="item_user_info">
              <img v-if="item.fd_sta_photo" :src="item.fd_sta_photo" alt="头像" />
              <img v-else :src="pic" alt="头像" />
              <div>
                <span>{{item.fd_sta_name}}</span>
                <br />
                <span>{{item.fd_jobs_name}}</span>
              </div>
            </div>
          </li>
          <li class="item_list_item one-txt-cut">{{item.fd_sta_stay_days}}</li>
          <li class="item_list_item one-txt-cut">{{item.fd_sta_merchants}}</li>
          <li class="item_list_item one-txt-cut">{{item.fd_recent_score}}</li>
          <li class="item_list_item one-txt-cut">{{item.fd_ongoing_score}}</li>
        </ul>
      </li>
    </ul>
  </div>
</template>
<script>
export default {
  name:'TableList',
  data() {
    return {
      pic:require('@/assets/images/morentouxiang.png'),
    };
  },
  props:{
    fromPage:{
      type:String,
      default:''
    },
    tableList:{
      type:Array,
      default:()=>[]
    }
  },
  methods: {
    //进入个人绩效结果页面
    subordinatesInfo(id) {
      if (this.fromPage=='subordinates') {
        this.$router.push({ name: "subordinatesInfo", query: { id: id } });
      } else {
        this.$router.push({ name: "myPerformance", query: { staffer_id: id } });
      }
      // console.log(id);
      
    },
  }
};
</script>
<style lang="less" scoped>
.table_list {
  width: 100%;
  height: auto;
  box-sizing: border-box;
  background: #fff;
  .refresh_wrapper{
    width: 100%;
    min-height: 300px;
}
.no_content{
    width: 100%;
    height: 30px;
    line-height: 30px;
    font-size: 20px;
    text-align: center;
    color: #999;
    margin-top: 100px;
}
  .search_bar {
    width: 100%;
    height: 44px;
    overflow: hidden;
    .van-search { padding-top: 0;padding-bottom: 0;height: 44px;}
  }
  .search_bar>div{height: 44px !important;}
  .sort_bar {
    width: 100%;
    height: 44px;
    line-height: 44px;
    background: #fff;
    border-bottom: 2px solid #f7f7f7;
    .sort_bar_list {
      display: flex;
      justify-content: space-between;
      align-items: center;
      text-align: center;
      height: 44px;
      line-height: 44px;
      color: #161618;
      background: #fff;
      .sort_bar_item {
        width: 100%;
        height: auto;
        flex: 1;
        .sort_bar_btn {
          display: flex;
          align-items: center;
          justify-content: center;
          div,
          p {
            max-width: 85px;
            line-height: 15px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
          }
          p {
            margin-left: 5px;
            span {
              color: #636466;
            }
            .active {
              color: #ff661a;
            }
          }
        }
      }
      .active {
        color: #ff661a;
      }
      .sort_bar_item:first-child {
        flex: 2;
        text-align: left;
      }
    }
  }
  .van_item {
    width: 100%;
    height: 68px;
    border-bottom: 2px solid #f7f7f7;
    .item_list {
      display: flex;
      height: 100%;
      justify-content: space-between;
      align-items: center;
      text-align: center;
      padding: 0 10px;
      box-sizing: border-box;
      .item_list_item {
        width: 100%;
        height: auto;
        flex: 1;
        .item_user_info {
          display: flex;
          align-items: center;
          div {
            max-width: 85px;
            line-height: 20px;
            margin-left: 5px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
          }
          img {
            width: 28px;
            height: 28px;
            border-radius: 28px;
          }
        }
        .cycle_status_desc {
          // max-width: 1rem;
          display: inline-block;
        }
      }
      .warning{color: #ff4066}
      .first_item_list_item {
        flex: 2;
        text-align: left;
      }
    }
  }
}
.van-search__action{font-size: 15px;color: #626466;}
/deep/ .van-field__left-icon .van-icon{font-size: 15px;font-weight: bolder;}
/deep/ .van-field__body{font-size: 14px;color: #999;}
/deep/.van-picker__cancel,
/deep/.van-picker__confirm {
  font-size: 14px;
  color: #02ccbd;
}
/deep/.van-picker__cancel {
  color: #999;
}
/deep/.van-picker-column {
  font-size: 13px;
  color: #232426;
}
</style>